<% gcp_organization_id = "#{external_attribute(pwd, 'gcp_organization_id', doc_generation)}" -%>
<% service_perimeter = grab_attributes(pwd)['service_perimeter'] -%>

describe.one do
  google_access_context_manager_access_policies(org_id: <%= gcp_organization_id %>).names.each do |policy_name|
    describe google_access_context_manager_service_perimeter(policy_name: policy_name, name: <%= doc_generation ? "'#{service_perimeter['name']}'" : "service_perimeter['name']" -%>) do
      it { should exist }
      its('title') { should cmp <%= doc_generation ? "'#{service_perimeter['title']}'" : "service_perimeter['title']" -%> }
      its('status.restricted_services') { should include <%= doc_generation ? "'#{service_perimeter['restricted_service']}'" : "service_perimeter['restricted_service']" -%> }
    end
  end
end